package com.liu.student.service.impl;

import com.liu.student.entity.Teacher;
import com.liu.student.mapper.TeacherMapper;
import com.liu.student.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {

    @Autowired
    private TeacherMapper teacherMapper;

    @Override
    public List<Teacher> findAll() {
        return teacherMapper.findAll();
    }

    @Override
    public Teacher findById(Long id) {
        return teacherMapper.findById(id);
    }

    @Override
    public Teacher findByUsername(String username) {
        return teacherMapper.findByUsername(username);
    }

    @Override
    public void save(Teacher teacher) {
        teacherMapper.insert(teacher);
    }

    @Override
    public void update(Teacher teacher) {
        teacherMapper.update(teacher);
    }

    @Override
    public void deleteById(Long id) {
        teacherMapper.deleteById(id);
    }

    @Override
    public long count() {
        return teacherMapper.count();
    }
}